<template>
  <div :style="color" :class="lightClass">

  </div>
</template>

<script>
export default {
  name: "Light",
  props: {
    lightOption: {
      type: Object,
      value: null,
    },
    status: {
      type: Number,
      value: 0,
    },
  },
  computed: {
    lightClass: function () {
      let subClass = 'close'
      console.log(this.status)
      if (this.status === 1) {
        subClass = 'on'
      } else if (this.status === 2) {
        subClass = 'fade'
      }
      return ['light', subClass]
    }
  },
  data: function () {
    return {
      color: "#FFFF00",
    }
  },
  created() {
    this.color = {
      background: this.lightOption.color
    }
  },
}
</script>

<style scoped>
.light {
  display: inline-block;
  height: 30px;
  width: 30px;
  border-radius: 30px;
}

.on {
  opacity: 1;
}

.close {
  opacity: 0.2;
}

@keyframes fade {
  from {
    opacity: 1.0;
  }
  50% {
    opacity: 0;
  }
  to {
    opacity: 1.0;
  }
}

.fade {
  animation: fade 618ms infinite;
}

</style>
